package com.wandian.cqcsk.adapter.mine;

import android.widget.LinearLayout;
import android.widget.TextView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.wandian.cqcsk.R;
import com.wandian.cqcsk.bean.TXConfigBean;

/**
 * @author Administrator
 * @date 2019/12/16-13:32
 * @description TXChooseRecycleAdapter
 **/
public class TXChooseRecycleAdapter extends BaseQuickAdapter<TXConfigBean, BaseViewHolder> {

    public TXChooseRecycleAdapter(int layoutResId) {
        super(layoutResId);
    }
    private int selectItem = 0;

    @Override
    protected void convert(BaseViewHolder helper, TXConfigBean item) {
        TextView tv_price_number = helper.getView(R.id.tv_price_number);
        TextView tv_coin_number = helper.getView(R.id.tv_coin_number);
        TextView tv_real_money = helper.getView(R.id.tv_real_money);
        tv_real_money.setText("到账金额:"+item.getRealityAmount()+"元");
        tv_price_number.setText("兑换金额:"+item.getAmount()+"元");
        tv_coin_number.setText(item.getGold()+"金币");
        LinearLayout ll_item = helper.getView(R.id.ll_item);
        if(selectItem == helper.getLayoutPosition()){
            ll_item.setBackground(mContext.getResources().getDrawable(R.drawable.button_red_square_stroke_selector_5));
        }else {
            ll_item.setBackground(mContext.getResources().getDrawable(R.drawable.button_gary_circle_stroke_selector_5));
        }
    }

    public void notifySelectItem(int selectItem){
        this.selectItem =selectItem;
        notifyDataSetChanged();
    }
}
